package edu.msse.signup.ui;

import java.util.Date;
import java.util.List;

import edu.msse.signup.EventService;
import edu.msse.signup.Users;

public class EventHandler {

	private EventService eventService;
	private ApplicationService applicationService;
	private String name;
	private String description;
	private Date startDate;
	private Date startTime;
	private Date endDate;
	private Date endTime;
	private Users coordinator;
	
	public EventHandler() {
	}
	
	public List getFutureEvents(){
		return eventService.getEvents();
	}

	public void setApplicationService(ApplicationService applicationService) {
		this.applicationService = applicationService;
	}

	public void setEventService(EventService eventService) {
		this.eventService = eventService;
	}
	
	public String createNew()
	{
		System.out.println("In the createNew");
		try{
			
			EventService.createEvent(name, description, startDate, startTime, endDate, endTime, coordinator);
		} catch (Exception x) {
			System.out.println("Exception: " + x.getMessage());
			x.printStackTrace();
            applicationService.addErrorMessage("eventForm:name","Name is required");
            return null;
        }
		
		return "home";
	}

	public Users getCoordinator() {
		return coordinator;
	}

	public void setCoordinator(Users coordinator) {
		this.coordinator = coordinator;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		
		this.endTime = endTime;;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public EventService getEventService() {
		return eventService;
	}

}
